package com.hopes.bizz.receive.controller;


import com.hopes.bizz.position.position.dto.ReceiveRtPositionDTO;
import com.hopes.bizz.receive.service.ReceiveEmployeeService;
import com.hopes.boss.common.core.util.R;
import com.hopes.common.receive.annotation.RecordLog;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpHeaders;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequiredArgsConstructor
@RequestMapping("/data/emplyee" )
@Tag(description = "data" , name = "接收员工数据" )
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
public class ReceiveEmployeeController {

    private final ReceiveEmployeeService receiveEmployeeService;

    /**
     * 上传人员实时数据接口
     * @param receiveRtPositionDTO 员工定位数据
     * @return R
     */
    @Operation(summary = "上传人员实时数据接口" , description = "上传人员实时数据接口" )
    @RecordLog(value = "上传人员实时数据接口", type = "EMPLOYEE_LOCATIONS")
    @PostMapping("/locations")
    public R employeeLocations(@RequestBody ReceiveRtPositionDTO receiveRtPositionDTO) {
        return R.ok(receiveEmployeeService.handleEmployeeLocation(receiveRtPositionDTO));
    }
}
